package com.example.springboot.project3.config;

import com.example.springboot.project3.dao.RegionStats;
import com.example.springboot.project3.service.GetDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class MyCommandLineRunner implements CommandLineRunner {
    Environment env;
    @Autowired
    private GetDataService service;
    //使用构造方法注入env
    public void CustomCommandLineRunner(Environment env) {
        this.env = env;
    }

    @Override
    public void run(String... args) throws Exception {
        List<RegionStats> data = service.getData();
//        System.out.println(data);
    }
}
